package com.dibang.app.operation.view.impl;

import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.dibang.app.R;
import com.dibang.app.bean.SafeCenterItem;
import com.dibang.app.mvp.abs.AbsView;
import com.dibang.app.operation.control.abs.SafeCenterControl;
import com.dibang.app.operation.model.abs.SafeCenterModel;
import com.dibang.app.operation.presenter.abs.SafeCenterPresenter;
import com.dibang.app.operation.view.abs.SafeCenterView;
import com.dibang.app.view.ViewHelper;

public class SafeCenterViewImpl extends AbsView<SafeCenterControl,SafeCenterView, SafeCenterPresenter, SafeCenterModel> implements SafeCenterView {

    @Override
    public void onSafeCenterContentViewChanged(@NonNull RecyclerView contentView) {
        ViewHelper.setRecyclerViewLinearLayoutManager(contentView);
        contentView.setAdapter(new BaseQuickAdapter<SafeCenterItem,BaseViewHolder>(R.layout.item_safe_content_layout,presenter.generateSafeCenter()) {
            @Override
            protected void convert(BaseViewHolder helper, SafeCenterItem item) {
                helper.setText(R.id.item_safe_center_title_view,item.getTitle());
                helper.setText(R.id.item_safe_center_more_view,item.getMore());
                TextView contentView = helper.getView(R.id.item_safe_center_content_view);
                contentView.setHint(item.getHint());
                helper.setTextColor(R.id.item_safe_center_more_view, ContextCompat.getColor(contentView.getContext(),item.getUnSettingMoreColor()));
            }
        });
    }
}
